<!-- 子列表 -->
<template>
    <div class="childTable">
        <Title :title="props.title" />
        <div class="content">
            <Button @bottonHandle="opbuttonclick" :opbutton="props.elTable_Options.opbutton"
                :flagIndex="props.flagIndex" />
            <Table ref="table" @handleClick="handleClick" :elTable_Options="props.elTable_Options" />
        </div>
    </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'

import Title from './title.vue'
import Button from './button.vue'
import Table from './table.vue'

let emits = defineEmits(['bottonHandle', 'handleClick'])

let props = defineProps({
    title: String,
    flagIndex: String,
    elTable_Options: {
        type: Object,
        default: () => ({})
    }
})

let table = ref(null)

let opbuttonclick = (dealway) => {
    emits('bottonHandle', dealway)
}

let handleClick = (row, index) => {
    emits('handleClick', row, index)
}

let setTableData = (list = []) => { 
    table.value.setTableData(list)
}

//列表选中项
let getSelection = () => {
    return table.value.getSelection()
}

defineExpose({ setTableData, getSelection })

</script>

<style lang="scss" scoped>
.childTable {
    width: 100%;
    background-color: #fff;

    .content {
        width: 100%;
        padding: 10px 20px;
    }
}
</style>